package ws

import (
	"gitee.com/cooge/impush/ws/conn"
	"golang.org/x/net/websocket"
	"net/http"
)

type WsServer struct {
}

func NewWsServer() *WsServer {
	var ws WsServer
	return &ws
}

func (this *WsServer) handler(wsconn *websocket.Conn) {
	ws := conn.NewWsConn(wsconn)
	ws.Start()
}

func (this *WsServer) start() {
	http.Handle("/ws", websocket.Handler(this.handler))
}

func Start() {
	ww := NewWsServer()
	ww.start()
}
